package com.mioto.ld.utils;

import com.mioto.ld.component.RelationOperationEnum;

import java.util.HashMap;
import java.util.Map;

/**
 * @author mioto-qinxj
 * @date 2024/5/25
 * @desc
 */
public class CompareUtil {

    public static final Map<RelationOperationEnum,Operation> OPERATION_MAP = new HashMap<>(4);

    static {
        OPERATION_MAP.put(RelationOperationEnum.CONDITION_TYPE_GT,((a,b) -> a >b));
        OPERATION_MAP.put(RelationOperationEnum.CONDITION_TYPE_GTE,((a,b) -> a >= b));
        OPERATION_MAP.put(RelationOperationEnum.CONDITION_TYPE_LT,((a,b) -> a < b));
        OPERATION_MAP.put(RelationOperationEnum.CONDITION_TYPE_LTE,((a,b) -> a <= b));
    }


    public interface Operation{
        boolean calculate(int a,int b);
    }

}
